package com.doujiang.Controller;

import com.doujiang.domain.dto.jhjNameCountDTO;
import com.doujiang.service.jhjIFavoriteService;
import com.doujiang.tools.jhjAjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/favorite/favorite")
public class jhjFavoriteController {
    @Autowired
    private jhjIFavoriteService favoriteService;

    @GetMapping("/rank/actor")
    public jhjAjaxResult getTopActors() {
        return jhjAjaxResult.success(favoriteService.getTopActors());
    }

    @GetMapping("/rank/directors")
    public jhjAjaxResult getTopDirectorsByFavorite() {
        List<jhjNameCountDTO> list = favoriteService.getTopDirectorsByFavorite();
        return jhjAjaxResult.success(list);
    }

}
